<template>
  <a-modal :width="width" title="审核" okText="确定" cancel-text="取消" @cancel="handleCancel" @ok="handleOk" :visible="visible$1">
    <a-form-model :model="form" :label-col="{ span: 6 }" :wrapper-col="{ span: 16 }">
      <a-form-model-item label="原上课日期">{{form.YSKRQ}}</a-form-model-item>
      <a-form-model-item label="新上课日期">{{form.XSKRQ}}</a-form-model-item>
      <a-form-model-item label="原上课周">{{form.YWEEK}}</a-form-model-item>
      <a-form-model-item label="新上课周">{{form.XWEEK}}</a-form-model-item>
      <a-form-model-item label="原上课节">{{form.SECTION}}</a-form-model-item>
      <a-form-model-item label="新上课节">{{form.XSECTION}}</a-form-model-item>
      <a-form-model-item label="原上课教室">{{form.jsmc}}</a-form-model-item>
      <a-form-model-item label="新上课教室">{{form.xjsmc}}</a-form-model-item>
      <a-form-model-item label="上课教学班">{{form.SKXZBDM}}</a-form-model-item>
      <a-form-model-item label="课程名称">{{form.kcmc}}</a-form-model-item>
      <a-form-model-item label="申请老师名称">{{teacherDetail ? teacherDetail.xm : ''}}</a-form-model-item>
      <a-form-model-item label="审核状态">
        <a-radio-group name="radioGroup" v-model="form.verifyStatus">
          <a-radio :value="1">通过</a-radio>
          <a-radio :value="2">未通过</a-radio>
        </a-radio-group>
      </a-form-model-item>
      <a-form-model-item label="不通过原因">
        <a-textarea v-model="form.verifyreason" auto-size style="width: 100%" />
      </a-form-model-item>
    </a-form-model>
  </a-modal>
</template>
<script>
import { apiScheduleClassSwitchTiaoke } from '@/api/schedule/index'
import apiBaseCommonVeCommon from '@/api/base/common-veCommon.js';
export default {
  name: 'TiaokeAudit',
  props: {
    visible: { type: Boolean },
    data: {
      type: Object,
      default() {
        return {}
      },
    },
  },
  data() {
    return {
      width: 800,
      teacherDetail: null,
      form: {},
    }
  },
  created() {},
  watch: {
    visible(n) {
      if (n) {
        this.form = { ...this.data }
        this.getTeacherDetail()
      } else {
        this.teacherDetail = null
      }
    },
  },
  computed: {
    visible$1: {
      get() {
        return this.visible
      },
      set(val) {
        this.$emit('update:visible', val)
      },
    },
  },
  methods: {
    handleCancel() {
      this.visible$1 = false
    },
    handleOk() {
      const params = { ...this.form }
      apiScheduleClassSwitchTiaoke.update(params).then((res) => {
        this.$message.success('审核成功')
        this.visible$1 = false
        this.$emit('success-callback')
      })
    },
    getTeacherDetail() {
      if (!this.data) {
        return
      }
      const params = {teacherId: this.data.teacherId}
      apiBaseCommonVeCommon.queryTeacherById(params).then(res => {
        this.teacherDetail = res.result
      })
    }
  },
}
</script>
<style scoped lang="less">
.global {
  .ant-form-item {
    margin-bottom: 0;
    display: inline-block;
    width: 50%;
  }
  .ant-modal-header {
    background-color: #00a0e9;
  }
}
</style>
